package com.voe.common;

import java.io.File;

public class Utility {

	public static final int RetErr_OK = 0;
	public static final int RetErr_Failed = -1;
	public static final int RetErr_JCB_Conv = 81001;
	public static final int RetErr_JCB_Set = 81002;

	public static CodecInst convert(OutputParam output) {
		CodecInst codec = new CodecInst();
		codec.pltype = (Integer)output.getObject()[0];
		codec.plname = (String)output.getObject()[1];
		codec.plfreq = (Integer)output.getObject()[2];
		codec.pacsize = (Integer)output.getObject()[3];
		codec.channels = (Integer)output.getObject()[4];
		codec.rate = (Integer)output.getObject()[5];
		return codec;
	}
	
	public static void throwNullPointerException(Object obj, String name) {
		if(obj == null)
			throw new NullPointerException(String.format("%s can not be empty", name));
	}
	
	public static String getAbsolutePath(String relativePath) {

		File directory = new File("");
		String dirPath = directory.getAbsolutePath();
		return dirPath + relativePath;
	}
	
	private Utility(){}
}
